//
//  DRSocialLikeCell.m
//  DoctorRen
//
//  Created by Lemon on 2018/11/29.
//

#import "DRSocialLikeCell.h"
#import <Masonry/Masonry.h>

@interface DRSocialLikeCell()

@property (nonatomic, strong) UILabel *label;

@end

@implementation DRSocialLikeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupSubViews];
    }
    return self;
}

-(void) setupSubViews{
    UIView * view = [UIView new];
    view.backgroundColor = UIColorFromHex(0xfafafa);
    [self addSubview: view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(0);
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(-20);
    }];
    
    UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"煮友圈_点赞_0"]];
    [view addSubview:iv];
    [iv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(20);
        make.left.mas_equalTo(16);
    }];
    
    self.label = [[UILabel alloc] init];
    self.label.numberOfLines = 0;
    self.label.font = [UIFont systemFontOfSize:13];
    self.label.textColor = UIColorFromHex(0x3B8B87);
    [view addSubview:self.label];
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(48);
        make.right.mas_equalTo(-20);
        make.bottom.mas_equalTo(-20);
        make.top.mas_equalTo(20);
    }];
    
}

-(void)setGoods:(NSArray *)goods{
    NSMutableString *string = [NSMutableString string];
    for (int i = 0; i< goods.count; i ++) {
        NSDictionary *dic = goods[i];
        [string appendString:dic[@"user_id"]];
        if (i != goods.count - 1) {
            [string appendString:@"、"];
        }
    }

    self.label.text = string;
}

@end
